<template>
	<view class="qq-tabbar">
		<u-tabbar :active-color="activeColor" :inactive-color="inactiveColor" 
		 :v-model="active" @change="switchTabs" :list="list" 
		 :mid-button="false"></u-tabbar>
	</view>
</template>
<script>
/** 用法：
 * <qq-tabbar current="0"></qq-tabbar>
 * 
 * */
export default {
	props:{
		activeColor2:{//激活的文字颜色
			type:[String],
			default:null
		},
		inactiveColor:{//未选中的颜色
			type:[String],
			default:'#999999'
		},
		current:{//当前激活第几个
			type:[String,Number],
			default:0
		}
	},
	data() {
		return { 
			active:0,
			activeColor:"#449BFD",
			list:[
				{
					iconPath: "/static/images/ad-home.png",
					selectedIconPath: "/static/images/ad-home-active.png",
					text: '首页', 
					customIcon: true,
					pagePath:"/admin/index/index",
				},
				{
					iconPath: "/static/images/ad-check.png",
					selectedIconPath: "/static/images/ad-check-active.png",
					text: '核实列表', 
					customIcon: true,
					pagePath:"/admin/check/list",
				},
				{
					iconPath: "/static/images/ad-demand.png",
					selectedIconPath: "/static/images/ad-demand-active.png",
					text: '需求处理', 
					customIcon: true,
					pagePath:"/admin/demand/list",
				},
				{
					iconPath: "/static/images/ad-service.png",
					selectedIconPath: "/static/images/ad-service-active.png",
					text: '服务列表', 
					customIcon: true,
					pagePath:"/admin/service/list",
				},
			]
		}
	}, 
	created(){
		this.active=this.current;
	},
	methods:{
		switchTabs(index){
			//关闭所有页面并打开
			uni.reLaunch({
				url:this.list[index].pagePath
			})
		}
	},
	watch:{},
	computed:{},
	destroyed(){}
}
</script>

<style lang="scss">
.qq-tabbar{ 
	height: 100upx;
	position: fixed;
	z-index: 999;
	
	bottom: 0;
	left:0;
	width: 100%;
	background-color: #fff;
}
</style>
